package io;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("bos.txt");
        BufferedOutputStream bos=new BufferedOutputStream(fos);
         String line="再见了妈妈今晚我就要远航";
         byte[]data=line.getBytes(StandardCharsets.UTF_8);
         long start=System.currentTimeMillis();
         bos.write(data);
         long end=System.currentTimeMillis();
         bos.close();
         System.out.println("写出完毕");
         System.out.println("总耗时："+(end-start)+"ms");
    }
}
